﻿#region License

// // -------------------------------------------------------------------------------------
// // This information refers to LogOneMinutePrecisionServiceInstaller.cs
// // 
// // Copyright 2012 ELEN7046 Group 2
// // 
// // Last Modified on: 2012-06-10
// // 
// // Contributors:
// // 
// // Amith Sewnarain
// // Elmar Vosloo
// // Jason Thorne
// // Satish Jewan
// // 
// // Wits University 
// // School of Electrical & Information Engineering
// // Software Engineering Tools and Techniques
// // 
// // -------------------------------------------------------------------------------------
// // 
// // This file (LogOneMinutePrecisionServiceInstaller.cs) is part of the DishDash Event Visualization System.
// // 
// // DishDash is free software: you can redistribute it and/or modify
// // it under the terms of the GNU General Public License as published by
// // the Free Software Foundation, either version 3 of the License, or
// // (at your option) any later version.
// // 
// // DishDash is distributed in the hope that it will be useful,
// // but WITHOUT ANY WARRANTY; without even the implied warranty of
// // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// // GNU General Public License for more details.
// // 
// // You should have received a copy of the GNU General Public License
// // along with DishDash.  
// // If not, see <http://www.gnu.org/licenses/>.
// // -------------------------------------------------------------------------------------

#endregion

#region Using Directives

using System.ComponentModel;
using System.Configuration.Install;
using System.ServiceProcess;

#endregion

namespace LogOneMinutePrecisionApp
{
    [RunInstaller(true)]
    public class LogOneMinutePrecisionServiceInstaller : Installer
    {
        private readonly ServiceProcessInstaller processInstaller;
        private readonly ServiceInstaller serviceInstaller;

        /// <summary>
        /// Initializes a new instance of the <see cref="LogOneMinutePrecisionServiceInstaller"/> class.
        /// </summary>
        public LogOneMinutePrecisionServiceInstaller()
        {
            // Instantiate installers for process and services.
            processInstaller = new ServiceProcessInstaller();
            serviceInstaller = new ServiceInstaller();

            // The services run under the system account.
            processInstaller.Account = ServiceAccount.LocalSystem;

            // The services are started automatically.
            serviceInstaller.StartType = ServiceStartMode.Automatic;

            // Set Service Name and Description
            serviceInstaller.ServiceName = "Dish-Dash One Minute Precision Logger";
            serviceInstaller.Description = "The Dish-Dash Logger logs all incoming events to a precision of 1 minute";

            // Add installers to collection.
            Installers.Add(serviceInstaller);
            Installers.Add(processInstaller);
        }
    }
}